package com.server.thisFacade.domain;

public class PageBase {
    public Integer getPageIndex() {
        return getPageNumber() * getPageSize();
    }

    public Integer getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(Integer pageNumber) {
        this.pageNumber = pageNumber;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public String getOrderString() {
        return orderString;
    }

    public void setOrderString(String orderString) {
        this.orderString = orderString;
    }

    public String getOrderType() {
        if ("desc".equalsIgnoreCase(orderType)) {
            return "DESC";
        }
        return "ASC";
    }

    public void setOrderType(String orderType) {
        this.orderType = orderType;
    }

    public int intOrderType(){
        return "DESC".equals(this.orderType) ? -1 : 1;
    }

    private Integer pageNumber;
    private Integer pageSize;

    private String orderString;
    private String orderType;
}
